# -*- python -*-
# ex: set syntax=python:

# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# See master.experimental/slaves.cfg for documentation.

categories = {
  'android' : {'master': 'NativeClientTryServer',
                'os': 'linux',
                'bits': '64',
      },
  'precise32': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'precise',
        'bits': '32',
      },
  'trusty64': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'trusty',
        'bits': '64',
      },
  'sanitizer': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'precise',
        'bits': '64',
      },
  'precise64': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'precise',
        'bits': '64',
      },
  'mac': {'master': 'NativeClientTryServer',
        'os': 'mac',
        'version': '10.9',
        'bits': '64',
      },
  'win32': {'master': 'NativeClientTryServer',
        'os': 'win',
        'version': 'win7',
        'bits': '32',
      },
  'win64': {'master': 'NativeClientTryServer',
        'os': 'win',
        'version': 'win7',
        'bits': '64',
      },
  'win8': {'master': 'NativeClientTryServer',
        'os': 'win',
        'version': 'win8',
        'bits': '64',
      },
  'panda': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'armboard',
        'bits': '32',
        'arm_tools': True,
      },
  'bare_win7': {'master': 'NativeClientTryServer',
        'os': 'win',
        'version': 'win7',
      },
  'bare_precise64': {'master': 'NativeClientTryServer',
        'os': 'linux',
        'version': 'precise',
        'bits': '64',
      },
}


categories_to_slaves = {
  'android': ['slave555-c4'],
  'precise32': ['vm%d-m4' % i for i in range(504, 510)],
  'trusty64': ['vm107-m4', 'slave135-c4', 'slave136-c4',
               'slave1202-c4', 'slave1203-c4'],
  'sanitizer': ['slave661-c4'],
  'precise64': ['slave%d-c4' % i for i in range(569, 584) + range(662, 714)],
  'mac': ['vm%d-m4' % i for i
          in range(741, 748) + range(668, 671) + range(655, 660)],
  'win32': ['vm%d-m4' % i for i in range(532, 539)],
  'win64': ['vm%d-m4' % i for i in range(539, 552) + [116]],
  'win8': ['vm%d-m4' % i for i in range(100, 103) + range(108, 111)],
  'panda': ['build%d-b4' % i for i in range(168, 171)],
  'bare_win7': ['build499-m4'],
  'bare_precise64': ['build498-m4'],
}

categories_to_builders = {
  'android': ['nacl-precise64-newlib-dbg-android',
              'nacl-precise64-newlib-opt-android'],
  'bare_precise64': ['nacl-precise64-bare-shared'],
  'bare_win7': ['nacl-win7-bare-shared'],
  'mac': ['nacl-mac_newlib_dbg',
          'nacl-mac_newlib_opt',
          'nacl-mac_glibc_dbg',
          'nacl-mac_glibc_opt',
          'nacl-mac_newlib_opt_pnacl',
          'nacl-mac_arm_newlib_opt',
          'nacl-toolchain-mac-pnacl-x86_32',
          'nacl-toolchain-mac-newlib-arm',
          'nacl-toolchain-mac-glibc',
          'nacl-mac-newlib-dbg-asan',
          'webports-mac-glibc-0',
          'webports-mac-glibc-1',
          'webports-mac-pnacl-0',
          'webports-mac-pnacl-1',
          'webports-mac-clang-0',
          'webports-mac-clang-1'],
  'panda': ['nacl-arm_hw_opt_panda', 'nacl-arm_hw_perf_panda'],
  'precise32': [ 'nacl-precise32_newlib_dbg',
                 'nacl-precise32_newlib_opt',
                 'nacl-precise32_glibc_opt',
                 'nacl-toolchain-linux-pnacl-x86_32'],
  'precise64': [ 'nacl-precise64_newlib_dbg',
                 'nacl-precise64_newlib_opt',
                 'nacl-precise64_arm_newlib_opt',
                 'nacl-precise64_arm_glibc_opt',
                 'nacl-precise64_glibc_opt',
                 'nacl-precise64_validator_opt',
                 'nacl-precise_64-newlib-arm_qemu-pnacl',
                 'nacl-precise_64-newlib-x86_32-pnacl',
                 'nacl-precise_64-newlib-x86_64-pnacl',
                 'nacl-precise_64-newlib-mips-pnacl',
                 'nacl-precise_64-newlib-x86_32-pnacl-spec',
                 'nacl-precise_64-newlib-x86_64-pnacl-spec',
                 'nacl-precise_64-newlib-dbg-asan',
                 'nacl-precise64_newlib_dbg_valgrind',
                 'nacl-precise64_glibc_dbg_valgrind',
                 'nacl-arm_opt_panda',
                 'nacl-arm_perf_panda',
                 'nacl-toolchain-precise64-newlib-arm',
                 'nacl-toolchain-precise64-glibc',
                 'nacl-toolchain-linux-pnacl-x86_64',
                 'webports-linux-glibc-0',
                 'webports-linux-glibc-1',
                 'webports-linux-glibc-2',
                 'webports-linux-glibc-3',
                 'webports-linux-glibc-4',
                 'webports-linux-glibc-5',
                 'webports-linux-pnacl-0',
                 'webports-linux-pnacl-1',
                 'webports-linux-pnacl-2',
                 'webports-linux-pnacl-3',
                 'webports-linux-pnacl-4',
                 'webports-linux-pnacl-5',
                 'webports-linux-clang-0',
                 'webports-linux-clang-1',
                 'webports-linux-clang-2',
                 'webports-linux-clang-3',
                 'webports-linux-clang-4',
                 'webports-linux-clang-5',
                 'webports-linux-toolchain-0',
                 'webports-linux-emscripten-0'],
  'sanitizer': [ 'nacl-toolchain-asan',
                 'nacl-toolchain-msan',
                 'nacl-toolchain-tsan',
                 'nacl-toolchain-ubsan'],
  'trusty64': ['nacl-toolchain-linux-pnacl-x86_64-staging',
               'nacl-toolchain-linux-pnacl_musl-x86_64',
               'nacl-toolchain-linux-pnacl-x86-64-driver'],
  'win32': ['nacl-win32_newlib_opt', 'nacl-win32_glibc_opt'],
  'win64': [ 'nacl-win64_newlib_dbg',
             'nacl-win64_newlib_opt',
             'nacl-win7_64_arm_newlib_opt',
             'nacl-win64_glibc_opt',
             'nacl-win7_64_newlib_opt_pnacl',
             'nacl-toolchain-win7-glibc',
             'nacl-toolchain-win7-pnacl-x86_64'],
  'win8': ['nacl-win8-64_newlib_dbg', 'nacl-win8-64_newlib_opt']
}

slaves = []

for category in categories:
  for hostname in categories_to_slaves[category]:
    slave = {}
    slave.update(categories[category])
    slave['builder'] = categories_to_builders[category]
    slave['hostname'] = hostname
    slave['category'] = category
    slaves.append(slave)
